var CustomerMedicalLog = {
    id: "CustomerMedicalTable",
    seItem: null,
    table: null,
    layerIndex: -1
};
CustomerMedicalLog.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '患者姓名', field: 'customerName', align: 'center', valign: 'middle', sortable: true,width:120},
        {title: '患者电话', field: 'customerPhone', align: 'center', valign: 'middle', sortable: true,width:140},
        {
            title: '操作时间', field: 'createtime', align: 'center', valign: 'middle',width:170,
            formatter: function (value, row, index) {
                return value.substring(0, 19);
            }
        },
        {title: '操作人', field: 'singlePerson', align: 'center', valign: 'middle',width:120},
        {title: '操作类型', field: 'logtype', align: 'center', valign: 'middle',width:120},
        {title: '变更记录', field: 'message', align: 'left', valign: 'middle',width:250},
        {title: '备注', field: 'remarks', align: 'left', valign: 'middle',width:250}
    ];
};
CustomerMedicalLog.formParams = function () {
    var queryData = {};
    queryData['singlePerson'] = $("#singlePerson").val();
    queryData['customerPhone'] = $("#customerPhone").val();
    queryData['customerName'] = $("#customerName").val();
    queryData['startTime'] = $("#startTime").val();
    queryData['endTime'] = $("#endTime").val();
    return queryData;
}
CustomerMedicalLog.resetSearch = function () {
    $("#singlePerson").val("");
    $("#customerPhone").val("");
    $("#customerName").val("");
    $("#startTime").val("");
    $("#endTime").val("");
    CustomerMedicalLog.search();
};
CustomerMedicalLog.search = function () {
    CustomerMedicalLog.table.refresh({query: CustomerMedicalLog.formParams()});
};
CustomerMedicalLog.today = function () {
    $("#startTime").val(setDateTime(new Date(),0) + " " + "00:00:00");
    $("#endTime").val(setDateTime(new Date(),0) + " " + "23:59:59");
    CustomerMedicalLog.search();
};
$(function () {
    var defaultColunms = CustomerMedicalLog.initColumn();
    var table = new BSTable(CustomerMedicalLog.id, "/customerStatusLog/numberList", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams(CustomerMedicalLog.formParams());
    CustomerMedicalLog.table = table.init();
    CustomerMedicalLog.table = table;
    CustomerMedicalLog.today();
    $(document).on('click','#laydate_clear,#laydate_today,#laydate_ok',function () {CustomerMedicalLog.search();});
    checkDate = function () {CustomerMedicalLog.search();};
});